package com.qzh;

import com.qzh.baseStruct.simpleStruct.Book;
import lombok.SneakyThrows;

import java.util.*;
import java.util.concurrent.*;

/**
 * 工具方法测试类
 */
public class threadTest {
    @SneakyThrows
    public static void main(String[] args) {
        BlockingDeque<Book> deque = new LinkedBlockingDeque<>(20);
        List<Book> bookList = new ArrayList<>();
      ExecutorService executorService = Executors.newFixedThreadPool(2);
    Producer producer = new Producer(deque,bookList);
        Customer customer = new Customer(deque,bookList);
    List<Runnable> runnables = new ArrayList<>();
    runnables.add(producer);
    runnables.add(customer);
    Thread thread1=new Thread(producer);
    Thread thread2=new Thread(customer);
        thread1.start();
        Thread.sleep(1000);//延后1000ms启动
        thread2.start();


    }
}
